package com.hxb.redisdemo.controller;

import com.hxb.redisdemo.service.IRedisService;
import com.hxb.redisdemo.service.RedisServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author HXB
 * @Title:
 * @Package
 * @Description:
 * @date 2019-12-199:48
 */
@RestController
@RequestMapping("redis")
public class MainController {

    @Autowired
    private IRedisService redisService;

    @RequestMapping(value = "add", method = RequestMethod.GET)
    public Map add(@RequestParam("key") String key, @RequestParam("value") String value) {
        Map m = new HashMap();
        redisService.setValue(key, value);
        m.put("成功", "添加成功");
        return m;
    }


}
